              package com.java.diagnostics.visualizer.impl.extensions;
              
              import com.java.diagnostics.visualizer.display.DataDisplayer;
              import java.util.HashSet;
              import java.util.List;
              import java.util.Set;
              import org.eclipse.core.runtime.IConfigurationElement;
              import org.eclipse.core.runtime.IExtension;
              
              public class DisplayerRegistry extends GCAndMemoryVisualizerExtensionRegistry
              {
                private static final String OUTPUT_TYPE = "outputType";
                private static final String TYPE = "type";
                private static final String EXTENSION_POINT = "com.java.diagnostics.visualizer.displayer";
                private static final IConfigurationElement[] ICONFIGURATION_TEMPLATE_ARRAY = new IConfigurationElement[0];
              
                private static final DataDisplayer[] TEMPLATE_ARRAY = new DataDisplayer[0];
              
                private static DisplayerRegistry registry = null;
              
                public static DisplayerRegistry getInstance()
                {
                  if (registry == null) {
                    registry = new DisplayerRegistry();
                  }
              
                  return registry;
                }
              
                protected String getExtensionPointID()
                {
                  return "com.java.diagnostics.visualizer.displayer";
                }
              
                public IConfigurationElement[] findExtensionsByOutputType(String outputType)
                {
                  IExtension[] extensions = getExtensions();
                  Set matches = new HashSet();
              
                  for (int i = 0; i < extensions.length; i++)
                  {
                    IExtension extension = extensions[i];
                    IConfigurationElement[] elements = extension
                      .getConfigurationElements();
              
                    for (int j = 0; j < elements.length; j++) {
                      IConfigurationElement element = elements[j];
              
                      IConfigurationElement[] children = element
                        .getChildren("outputType");
              
                      if (children != null) {
                        for (int k = 0; k < children.length; k++) {
                          if ((children[k].getAttribute("type") != null) && 
                            (children[k].getAttribute("type").equals(
                            outputType))) {
                            matches.add(element);
                          }
                        }
                      }
                    }
              
                  }
              
                  return 
                    (IConfigurationElement[])matches
                    .toArray(ICONFIGURATION_TEMPLATE_ARRAY);
                }
              
                public DataDisplayer[] instantiateDisplayers()
                {
                  List displayers = instantiateExtensions();
              
                  return (DataDisplayer[])displayers.toArray(TEMPLATE_ARRAY);
                }
              }

